$(function () {
    var token = sessionStorage.getItem("token");
    var bank_credit_id = sessionStorage.getItem("dadid");
    var method = "Bankcredit|get_detail";
    var d = {};
    d.token = token;
    d.method = method;
    d.bank_credit_id = bank_credit_id;
    $.ajax({
        type: "post",
        url: "http://www.rice.com/app/api/h5_access",
        data: d,
        dataType: "json",
        success: function (result) {
            if (result.status == "1") {
                var data = result.data;
                $(".head_text").html(data.cardName);
                var sttr = "";
                sttr += ' <div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">信用卡</div><div class="am-u-sm-6" style="text-align: right;">*** *** **** ' + data.cardAfterFour + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">银行名称</div><div class="am-u-sm-6" style="text-align: right;">' + data.cardName + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">账单日</div><div class="am-u-sm-6" style="text-align: right;">' + data.statement_date + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">还款日</div><div class="am-u-sm-6" style="text-align: right;">' + data.repayment_date + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">已还款金额</div><div class="am-u-sm-6" style="text-align: right;">' + data.money_pay + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">未还款金额</div><div class="am-u-sm-6" style="text-align: right;">' + data.money_not_pay + '</div></div>';
                sttr += '<div class="am-u-sm-12 fdd" ><div class="am-u-sm-6">当前保证金</div><div class="am-u-sm-6" style="text-align: right;">' + data.bond + '</div></div>';
                $(".xyk_xq").html(sttr);
            } else if (result.status == "2") {
                alert(result.message);
                location.href = 'login.html';
            } else {
                alert(result.message);
            }
        }
    })
    $(".del").click(function () {
        //询问框
        layer.open({
            type: 0,
            skin: 'layui-layer-rim', //加上边框
            area: ['220px', '140px'], //宽高
            content: '<div><ul class="am-list"><li style="height:35px;line-height:35px;" onclick="javascript:location.href=\'information.html\';">绑定邮箱</li><li onclick="javascript:ddd();" style="height:35px;line-height:35px;">删除此卡</li></ul></div>'
        });
    })
})

function ddd() {
    var r = confirm("是否删除卡")
    if (r == true) {
        layer.open({
            type: 1,
            offset: 'b',
            content: '<div style="width:200px;height:100px;"><ul id="tan-c" class="am-list h35"></ul></div>',
            btn: '关闭全部',
            btnAlign: 'c',
            shade: 1,
            yes: function () {
                layer.closeAll();
            }
        });
    } else {
        return false;
    }
    var d1 = $("#d2").html();
    $("#tan-c").html(d1);
}